import 'package:flutter/material.dart';
import 'package:power_house/pages/home/tab_index/index_re_command_data.dart';
import 'package:power_house/widgets/common_image.dart';

var textStyle = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500);

class IndexReCommandItemWidget extends StatelessWidget {
  final IndexReCommandItem data;

  const IndexReCommandItemWidget({Key? key, required this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Navigator.of(context).pushNamed(data.navigateUri);
      },
      child: Container(
        decoration: const BoxDecoration(color: Colors.white),
        width: (MediaQuery.of(context).size.width - 10.0 * 3) / 2, //MediaQuery.of(context).size.width 屏幕宽度获取
        padding: const EdgeInsets.all(10.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Column(
              children: [
                Text(
                  data.title,
                  style: textStyle,
                ),
                Text(data.subTitle, style: textStyle),
              ],
            ),
            CommonImage(
              data.imageUri,
              width: 55.0,
            )
          ],
        ),
      ),
    );
  }
}
